from jobs.sql_mehods import *
from datetime import datetime, timedelta

db = MySQLHelper(host='mmservice-05.mysql.hotgrid.cn', port=3306,
                 user='electricity_api_service', password='GJlfh7&#jg',
                 db='electricity_data', charset='utf8')
# 中心数据库,
# db = MySQLHelper(host='10.20.7.227', port=33176,
#                  user='electricity_data', password='EF2zUl1GHss3yqay',
#                  db='electricity_data', charset='utf8')
# 查询需要删除的报警数据

dele_te_sql=f"""
DELETE ewr 
FROM elec_warn_records ewr 
JOIN (
SELECT id 
FROM elec_warn_records
WHERE start_time >= '2024-01-16 13:00:00' AND start_time <= '2024-01-17 23:55:00') t ON ewr.id = t.id"""


print(db.execute_edit(dele_te_sql))

